<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1.keyup 按键弹起的时候触发
        // document.onkeyup = function () {
        //     console.log('弹起');
        // }
        document.addEventListener('keyup',function () {
            console.log('弹起');
        })
        // 2.keydown 按键按下的时候触发
        document.addEventListener('keydown', function (){
            console.log('压下');
        })
        // 3.keypress 按键按下的时候触发，不能识别功能键
        document.addEventListener('keydown', function (){
            console.log('按压');
        })
        // 4.执行顺序 231
    </script>
</body>
</html>